import {koaBody} from 'koa-body';
import constant from "../../common/constant.js";

//multipart: 是否支持多文件上传
const allowFilesUpload = (multipart = false) => {
  return koaBody({
    multipart: multipart,
    formidable: {
      maxFileSize: constant.MAX_FILE_SIZE,    // 设置上传文件大小最大限制
      keepExtensions: true, //保留拓展名
      uploadDir: constant.FILE_PATH, //文件上传目录
    },
  })

}
export default allowFilesUpload;
